package com.hua.designpattern.behavioral.observer.subscriber;

import java.util.HashSet;

public class PublisherConcrete1 extends PublisherAbstract {

	public PublisherConcrete1() {
		subscribers = new HashSet<SubscriberAbstract>();
	}

	@Override
	public void addSubscriber(SubscriberAbstract subscriber) {
		subscribers.add(subscriber);

	}

	@Override
	public void removeSubscriber(SubscriberAbstract subscriber) {
		subscribers.remove(subscriber);
	}

	@Override
	public void notityAllSubscriber() {
		for (SubscriberAbstract subscriber : subscribers) {
			subscriber.update(message);
		}
	}

}
